/**
 * File Particle.java Package robocup.component.filters Project Robocup Date Jun
 * 19, 2005 Web www.dai-labor.de
 * 
 * @author Grzegorz Lehmann
 */
package robocup.component.filters;

import robocup.component.geometry.Vektor;

/**
 * <code>Particle</code>
 * 
 * @author Grzegorz Lehmann
 */
public class Particle
    extends Vektor {

  public final static Particle getDummyParticleInstance(){
    return new Particle(new Vektor(), 1.0,0);
  }
  
  private double       probability;

  private double distance;

  /**
   * <code>Particle</code> constructor
   * 
   * @param v
   * @param p
   * @param dist
   */
  public Particle(
      final Vektor v,
      final double p,
      final double dist) {

    super(Vektor.XY, v.x, v.y);
    this.probability = p;
    this.distance = dist;
  }

  /**
   * <code>getProbability</code> getter
   * 
   * @return returns the probability.
   */
  public final double getProbability() {

    return this.probability;
  }

  /**
   * <code>getDistance</code> getter
   * 
   * @return returns the distance.
   */
  public final double getDistance() {

    return this.distance;
  }

  /**
   * <code>scale</code>
   * 
   * @param scale
   */
  public final void scale(final double scale) {

    if (scale > 0) {
      this.probability /= scale;
    }
  }
  
  /**
   * resets the particle inner values
   */
  public final void reset(){
    super.reset();
    this.probability = 1;
    this.distance = 0;
  }
  
  public final void copy(final Particle p1){
    super.copy(p1);
    this.probability = p1.probability;
    this.distance = p1.distance;
  }

  
  /**
   * Sets the distance
   * 
   * @param distance double, the distance to set
   */
  public void setDistance(final double distance) {
  
    this.distance = distance;
  }

  
  /**
   * Sets the probability
   * 
   * @param probability double, the probability to set
   */
  public void setProbability(final double probability) {
  
    this.probability = probability;
  }
}
